home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / amiga / gui / x / twm93053.lha / twm / menus.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-29  |  5.9 KB  |  155 lines

  1. /*****************************************************************************/
  2. /**       Copyright 1988 by Evans & Sutherland Computer Corporation,        **/
  3. /**                          Salt Lake City, Utah                           **/
  4. /**  Portions Copyright 1989 by the Massachusetts Institute of Technology   **/
  5. /**                        Cambridge, Massachusetts                         **/
  6. /**                                                                         **/
  7. /**                           All Rights Reserved                           **/
  8. /**                                                                         **/
  9. /**    Permission to use, copy, modify, and distribute this software and    **/
  10. /**    its documentation  for  any  purpose  and  without  fee is hereby    **/
  11. /**    granted, provided that the above copyright notice appear  in  all    **/
  12. /**    copies and that both  that  copyright  notice  and  this  permis-    **/
  13. /**    sion  notice appear in supporting  documentation,  and  that  the    **/
  14. /**    names of Evans & Sutherland and M.I.T. not be used in advertising    **/
  15. /**    in publicity pertaining to distribution of the  software  without    **/
  16. /**    specific, written prior permission.                                  **/
  17. /**                                                                         **/
  18. /**    EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD    **/
  19. /**    TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES  OF  MERCHANT-    **/
  20. /**    ABILITY  AND  FITNESS,  IN  NO  EVENT SHALL EVANS & SUTHERLAND OR    **/
  21. /**    M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL  DAM-    **/
  22. /**    AGES OR  ANY DAMAGES WHATSOEVER  RESULTING FROM LOSS OF USE, DATA    **/
  23. /**    OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER    **/
  24. /**    TORTIOUS ACTION, ARISING OUT OF OR IN  CONNECTION  WITH  THE  USE    **/
  25. /**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
  26. /*****************************************************************************/
  27.  
  28.  
  29. /***********************************************************************
  30.  *
  31.  * $XConsortium: menus.h,v 1.24 89/12/10 17:46:26 jim Exp $
  32.  *
  33.  * twm menus include file
  34.  *
  35.  * 17-Nov-87 Thomas E. LaStrange        File created
  36.  *
  37.  ***********************************************************************/
  38.  
  39. #ifndef _MENUS_
  40. #define _MENUS_
  41.  
  42. #define TWM_ROOT    "bLoB_GoOp"    /* my private root menu */
  43. #define TWM_WINDOWS    "TwmWindows"    /* for f.menu "TwmWindows" */
  44.  
  45. #define MAX_FILE_SIZE 4096    /* max chars to read from file for cut */
  46.  
  47. typedef struct MenuItem
  48. {
  49.     struct MenuItem *next;    /* next menu item */
  50.     struct MenuItem *prev;    /* prev menu item */
  51.     struct MenuRoot *sub;    /* MenuRoot of a pull right menu */
  52.     struct MenuRoot *root;    /* back pointer to my MenuRoot */
  53.     char *item;            /* the character string displayed */
  54.     char *action;        /* action to be performed */
  55.     Pixel fore;            /* foreground color */
  56.     Pixel back;            /* background color */
  57.     Pixel hi_fore;        /* highlight foreground */
  58.     Pixel hi_back;        /* highlight background */
  59.     short item_num;        /* item number of this menu */
  60.     short x;            /* x coordinate for text */
  61.     short func;            /* twm built in function */
  62.     short state;        /* video state, 0 = normal, 1 = reversed */
  63.     short strlen;        /* strlen(item) */
  64.     short user_colors;        /* colors were specified */
  65. } MenuItem;
  66.  
  67. typedef struct MenuRoot
  68. {
  69.     struct MenuItem *first;    /* first item in menu */
  70.     struct MenuItem *last;    /* last item in menu */
  71.     struct MenuRoot *prev;    /* previous root menu if pull right */
  72.     struct MenuRoot *next;    /* next in list of root menus */
  73.     char *name;            /* name of root */
  74.     Window w;            /* the window of the menu */
  75.     Window shadow;        /* the shadow window */
  76.     Pixel hi_fore;        /* highlight foreground */
  77.     Pixel hi_back;        /* highlight background */
  78.     short mapped;        /* NEVER_MAPPED, UNMAPPED, or MAPPED */
  79.     short height;        /* height of the menu */
  80.     short width;        /* width of the menu */
  81.     short items;        /* number of items in the menu */
  82.     short pull;            /* is there a pull right entry ? */
  83.     short entered;        /* EnterNotify following pop up */
  84.     short real_menu;        /* this is a real menu */
  85. } MenuRoot;
  86.  
  87. #define NEVER_MAPPED    0    /* constants for mapped field of MenuRoot */
  88. #define UNMAPPED    1
  89. #define MAPPED        2
  90.  
  91.  
  92. typedef struct MouseButton
  93. {
  94.     int func;            /* the function number */
  95.     int mask;            /* modifier mask */
  96.     MenuRoot *menu;        /* menu if func is F_MENU */
  97.     MenuItem *item;        /* action to perform if func != F_MENU */
  98. } MouseButton;
  99.  
  100. typedef struct FuncKey
  101. {
  102.     struct FuncKey *next;    /* next in the list of function keys */
  103.     char *name;            /* key name */
  104.     KeySym keysym;        /* X keysym */
  105.     KeyCode keycode;        /* X keycode */
  106.     int cont;            /* context */
  107.     int mods;            /* modifiers */
  108.     int func;            /* function to perform */
  109.     char *win_name;        /* window name (if any) */
  110.     char *action;        /* action string (if any) */
  111. } FuncKey;
  112.  
  113. extern int RootFunction;
  114. extern MenuRoot *ActiveMenu;
  115. extern MenuItem *ActiveItem;
  116. extern int MoveFunction;
  117. extern int WindowMoved;
  118. extern int ConstMove;
  119. extern int ConstMoveDir;
  120. extern int ConstMoveX;
  121. extern int ConstMoveY;
  122. extern int ConstMoveXL;
  123. extern int ConstMoveXR;
  124. extern int ConstMoveYT;
  125. extern int ConstMoveYB;
  126.  
  127. #define MAXMENUDEPTH    10    /* max number of nested menus */
  128. extern int MenuDepth;
  129.  
  130. #define MOVE_NONE    0    /* modes of constrained move */
  131. #define MOVE_VERT    1
  132. #define MOVE_HORIZ    2
  133.  
  134. #define WARPSCREEN_NEXT "next"
  135. #define WARPSCREEN_PREV "prev"
  136. #define WARPSCREEN_BACK "back"
  137.  
  138. #define COLORMAP_NEXT "next"
  139. #define COLORMAP_PREV "prev"
  140. #define COLORMAP_DEFAULT "default"
  141.  
  142. extern void InitTitlebarButtons();
  143. extern void InitMenus();
  144. extern MenuRoot *NewMenuRoot();
  145. extern MenuItem *AddToMenu();
  146. extern Bool PopUpMenu();
  147. extern MenuRoot *FindMenuRoot();
  148. extern Bool AddFuncKey();
  149. extern int ExecuteFunction();
  150. extern int DeferExecution();
  151. extern void Execute();
  152. extern void FocusOnRoot();
  153.  
  154. #endif /* _MENUS_ */
  155.